const mongoose = require('../db/db');
//4、创建结构对象
let BookSchema = new mongoose.Schema({
    id: {
        type: 'number',
        required: true,
        unique: true
    },
    name: {
        type: 'string',
        required: true,
        unique: true
    },
    infro: {
        type: 'string',
        required: true
    },
    img: {
        type: 'string',
        required: true
    },
    autor: {
        type: 'string',
        required: true
    }
});
//5、创建模型对象
let bookModel = mongoose.model('book', BookSchema, 'book');
module.exports = bookModel;
